package com.aaa.doctor.controller.api;

import com.aaa.doctor.service.CareOrderService;
import com.aaa.doctor.vo.CareOrderVo;
import com.aaa.entity.CareOrder;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author MuChengGuo
 * @date 2023/3/25 8:54
 * Description: TODO
 **/
@Api(tags = "前端 - 药用处方")
@RestController
@RequestMapping("/doctor/api/careOrder")
public class CareOrderApiController {

    @Autowired
    private CareOrderService careOrderService;

    @GetMapping("getListByPatientId/{patientId}")
    @ApiOperation(value = "通过患者ID(patientId)查询患者药用处方信息&检查和用药项目明细 - CareOrder")
    public Result<List<CareOrder>> getListByPatientId(
            @ApiParam(value = "当前患者ID", required = true) @PathVariable String patientId
    ) {
        return careOrderService.getListByPatientId(patientId);
    }

    @PostMapping("saveCareOrderItem")
    @ApiOperation(value = "新开就诊 - 添加药品")
    public Result<String> saveCareOrderItem(@RequestBody CareOrderVo careOrderVo) {
        return careOrderService.saveCareOrderItem(careOrderVo);
    }

    @GetMapping("queryCareOrdersByChId/{chId}")
    @ApiOperation(value = "新开就诊 - 根据病历ID查询处方信息")
    public Result<List<CareOrder>> queryCareOrdersByChId(@PathVariable String chId) {
        return careOrderService.queryCareOrdersByChId(chId);
    }

    @GetMapping("getCareHistoryByChId/{chId}")
    @ApiOperation(value = "如果有数据根据病历ID查询处方信息")
    public Result<List<CareOrder>> getCareHistoryByChId(@PathVariable String chId) {
        return careOrderService.getCareHistoryByChId(chId);
    }

}
